﻿package app.view.components.card 
{
	import flash.display.Sprite;
	
	/**
	 * Менеджер карточек
	 * @author Dmitryi_Koruagin, icq:585466579, dmitryikoruagin@snzflash.com
	 */
	public class CardManager extends Sprite
	{
		private var _cardBgd:CardBgd;
		private var _typeCard:int;
		private var _typeScroll:int;
		private var _data:Object;
		private var _current:CardBase;
		private var _card:*;
		/**
		 * Менеджер карточек
		 * @param	type (0-auto, 1-firm, 2-flat)
		 * @param	typeScroll (0-vartical, 1-horizontal)
		 */
		public function CardManager(typeCard:int=0,typeScroll:int=0) 
		{
			_typeCard = typeCard;
			_typeScroll = typeScroll;
			
			_cardBgd = new CardBgd();
			addChild(_cardBgd);
			
			init();
		}
		
		private function init():void
		{
			
		}
		
		public function swapCard(id:int):void
		{
			_card:CardBase;
			
			switch (_typeCard) 
			{
				case 0:
					_card = new CardAuto();
				break;
				
				case 1:
					_card = new CardFirm();
				break;
				
				case 2:
					_card = new CardFlat;
				break;
			};
			
			/*
			if (_current) 
			{ 
				_current.destroy();
				addEventListener(MenuMainEvent.FINISH_HIDE_SECTION, onFinishHide,true,1);
			}
			if (page)
			{
				addChild(page);
				_current = page;
				_current.showSection();
				
			};//*/
			
			
		}
		
		public function get data():Object { return _data; }
		
		public function set data(value:Object):void 
		{
			_data = value;
			
		}
		
	}

}